<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="com.ffcs.crmd.platform.ui.utils.JspUtil"%>
<!DOCTYPE html>
<jsp:include page="/resources/theme/default/include/default-header-inc.jsp"></jsp:include>
<jsp:include page="/resources/theme/default/include/default-footer-inc.jsp"></jsp:include>
<html>
<head>
<title>菜单管理</title>
<link rel="stylesheet" href="<%=JspUtil.path(request)%>/tsp/css/public.css" />
<script type="text/javascript" src="./js/job-service.js"></script>
<script type="text/javascript" src="../cluster/cluster-service.js"></script>
<script type="text/javascript" src="../job-group/js/job-group-service.js"></script>
<script type="text/javascript" src="../task-identity/task-identity-service.js"></script>
<script type="text/javascript" src="../job-identity-info/job-identity-info-service.js"></script>
<script type="text/javascript" src="../job-death/js/job-death-service.js"></script>
<script type="text/javascript" src="../job-detail/js/job-detail-service.js"></script>
<script type="text/javascript" src="../job-detail-track/js/job-detail-track-service.js"></script>
<script type="text/javascript" src="../task-connection-info/task-connection-info-service.js"></script>
<script type="text/javascript" src="../public/public-service.js"></script>

<script type="text/javascript" src="./js/job-controller.js"></script>
<script type="text/javascript" src="../job-retry/js/job-retry-controller.js"></script>
<script type="text/javascript" src="../job-running/js/job-running-controller.js"></script>
<script type="text/javascript" src="../job-death/js/job-death-controller.js"></script>
</head>
<body ng-app="jobApp" ng-controller="jobCtrl" style="background-color: transparent;">
	<div style="margin-top: 12px;">
		<div class="panel">
			<div class="panel-heading">
				<i class="mark"></i>任务信息
			</div>
			<div class="panel-body" style="padding-top: 0px;">
				<div id="jobTableToolbar" class="btn-group" style="width: 100%;">
					<button id="jobAddButton" class="btn btn-sm btn-blue" data-toggle="modal" data-target="#jobModal"
						ng-click="action='ADD'" ng-show="userName == 'admin'">
						<i class="glyphicon glyphicon-plus-sign"></i> 新增
					</button">
					<button id="jobModButton" class="btn btn-sm btn-blue" data-toggle="modal" data-target="#jobModal"
						ng-click="action='MOD'" ng-show="userName == 'admin'" disabled>
						<i class="glyphicon glyphicon-pencil"></i> 修改
					</button>
					<button id="jobRemoveButton" class="btn btn-sm btn-danger" ng-click="deleteJob();"  
						 ng-show="userName == 'admin'" disabled>
						<i class="glyphicon glyphicon-remove"></i> 删除
					</button>
					<button id="jobStopButton" class="btn btn-sm btn-warning" ng-click="pauseJob();"  disabled>
						<i class="glyphicon glyphicon-pause"></i> 暂停
					</button>
					<button id="jobResumeButton" class="btn btn-sm btn-warning" ng-click="resumeJob();"  disabled>
						<i class="glyphicon glyphicon-stop"></i> 唤醒
					</button>
					<button id="jobClearDetailButton" class="btn btn-sm btn-danger" ng-click="removeJobDetail();" 
					 ng-show="userName == 'admin'" disabled>
						<i class="glyphicon glyphicon-trash"></i> 清空子任务
					</button>
					
					<form class="form-inline pull-right">
						<div class="search-inline">
							<label>任务组：</label> 
							<input select2 type="text" class="form-control input-sm" ng-model="jobVO.queryJobGroupId" config="jobGroupSelectConfig" style="width: 200px;"/>
							<label>任务名称：</label> 
							<input type="text" class="form-control input-sm" ng-model="jobVO.queryName">
							<label>备注：</label> 
							<input type="text" class="form-control input-sm" ng-model="jobVO.queryDescription">
							<label>标识：</label> 
							<input type="text" class="form-control input-sm" ng-model="jobVO.queryIdentity">
							<button type="button" class="btn btn-sm btn-blue" ng-click="queryJobTable();">查询</button>
						</div>
					</form>
				</div>
				<div class="table-responsive">
					<table id="jobTable"
						data-id-field="id"
						data-side-pagination="server" 
						data-toolbar="#jobTableToolbar" 
						data-click-to-select="true"
						data-pagination="true" 
						data-page-size="10"
						data-query-params-type="" 
						data-detail-view="true"
						data-page-list="[5, 10, 20, 30]">
						<thead>
							<tr>
								<th data-checkbox='true' />
								<th data-field="name" data-align="center" data-valign="middle" data-class="table-column" data-width="28%">任务名称</th>
								<th data-field="jobGroupName" data-align="center" data-valign="middle" data-class="table-column" data-width="10%">任务组</th>
								<th data-field="jobType" data-align="center" data-valign="middle" data-class="table-column" data-width="5%" data-formatter="jobTypeFormatter">任务类型</th>
 								<th data-field="repeatCount" data-align="center" data-valign="middle" data-class="table-column" data-width="5%" data-formatter="repeatCountFormatter">重复次数</th>
								<th data-field="repeatInterval" data-align="center" data-valign="middle" data-class="table-column" data-width="5%">时间间隔</th>
								<th data-field="cronExpression" data-align="center" data-valign="middle" data-class="table-column" data-width="12%">Cron表达式</th>
								<th data-width="45%" data-align="center" data-valign="middle" data-class="table-column operation" 
									data-events="jobEvents" data-formatter="jobFormatter">操作</th>
							</tr>
						</thead>
					</table>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="./job-modal.jsp"></jsp:include>
	<jsp:include page="./job-config-detail-modal.jsp"></jsp:include>
	<jsp:include page="../job-identity-info/job-identity-info-modal.jsp"></jsp:include>
	<jsp:include page="../task-connection-info/task-connection-info-modal.jsp"></jsp:include>
	
	<div ng-controller="jobDeathController">
		<jsp:include page="../job-death/job-death.jsp"></jsp:include>
	</div>
	<div ng-controller="jobRetryController">
		<jsp:include page="../job-retry/job-retry.jsp"></jsp:include>
	</div>
	<div ng-controller="jobRunningController">
		<jsp:include page="../job-running/job-running.jsp"></jsp:include>
		<jsp:include page="../job-running/job-thread-info-modal.jsp"></jsp:include>
	</div>
</body>
</html>